import 'bootstrap/dist/css/bootstrap.min.css'
import $ from 'jquery';
window.jQuery = window.$ = $;
import AV from 'leancloud-storage';


$('#login_failed').hide();

AV.init({
    appId: "quH6NN19myKMB7rOxmeGloJu-MdYXbMMI",
    appKey: "afW1u6ygczPCba2GgWveUOKY",
    serverURL: "https://notifications.shengnan.fun"
});

$('#form_login').on('submit', (e) => {
    e.preventDefault();
    $('#login_failed').hide();

    let name = $('#input_email').val();
    let password = $('#input_password').val();
    AV.User.logIn(name, password).then((value) => {
        console.log(`login success, can redirect to next page now`);
    }).catch((reason) => {
        $('#login_failed').show();
    });

    console.log(`click the login button, ${name}, ${password}`);
});
